#ifndef STARTUPPROCESS_H_
#define STARTUPPROCESS_H_

#include "../GUI/gui.h"

class StartUpProcess : public sigslot::has_slots<>
{
	public:
		static StartUpProcess * Instance() { if(!instance) instance = new StartUpProcess(); return instance; }
		static void DestroyInstance() { if(instance) delete instance; instance = NULL; }
		
		void Run(int argc, char *argv[]);
		void SetTxt(const char * text) { Progress(); SetTextf(text); }
		
	private:
		StartUpProcess();
		~StartUpProcess();
		
		static StartUpProcess *instance;
		
		int TotalStep;
		int Done;
		bool Canceled;
		bool DrawCancel;
		
		void InitScreen();
		void Progress();
		static void ParseArguments(int argc, char *argv[]);
		void TextFade(int direction);
		void SetTextf(const char * format, ...);
		bool USBSpinUp();
		void OnCancelClick(GuiButton *sender, int pointer, const POINT &p);
		void Draw();
		
		GuiImageData * GXImageData;
		GuiImageData * ProgressBarOutlineData;
		GuiImageData * ProgressBarEmptyData;
		GuiImageData * ProgressBarData;
		
		GuiImage * background;
		GuiImage * GXImage;
		GuiImage * ProgressBarOutline;
		GuiImage * ProgressBarEmpty;
		GuiImage * ProgressBar;
		
		GuiText * titleTxt;
		GuiText * messageTxt;
		GuiText * cancelTxt;
		
		GuiButton * CancelBtn;
		
		GuiTrigger * trigB;
};

#endif
